﻿using System.Collections.Generic;

namespace UniSender
{
    using Expando = Dictionary<string, object>;
    using IExpando = IDictionary<string, object>;

    public class ExportConfig
    {
        public virtual long? ListId { get; set; }
        public virtual string[] FieldNames { get; set; }
        public virtual string Tag { get; set; }
        public virtual string Email { get; set; }
        public virtual ContactStatus? EmailStatus { get; set; }
        public virtual string Phone { get; set; }
        public virtual ContactStatus? PhoneStatus { get; set; }
        public virtual int? Offset { get; set; }
        public virtual int? Limit { get; set; }

        public virtual IExpando Serialize()
        {
            var args = new Expando();

            args["list_id"] = ListId;
            args["field_names"] = FieldNames;
            args["tag"] = Tag;
            args["email"] = Email;
            args["email_status"] = EmailStatus.Stringify();
            args["phone"] = Phone;
            args["phone_status"] = PhoneStatus.Stringify();
            args["offset"] = Offset;
            args["limit"] = Limit;

            return args;
        }
    }
}
